clc; clear; close all

% 参数
a  = 1;
b2 = 2*pi;
c  = 11.5;
N_total = 6000;          % 总步数
transient = 1000;        % 丢弃暂态
x0 = 0.3; y0 = 0.5; z0 = 0.6;

% 预分配轨迹
X = zeros(N_total - transient, 1);
Y = zeros(N_total - transient, 1);
Z = zeros(N_total - transient, 1);

x = x0; y = y0; z = z0;

for i = 1:N_total
    % 用你的SIMM函数推进系统
    xyz_next = SIMM(x, y, z, a, b2, c);
    x = xyz_next(1);
    y = xyz_next(2);
    z = xyz_next(3);

    if i > transient
        idx = i - transient;
        X(idx) = x;
        Y(idx) = y;
        Z(idx) = z;
    end
end

% 绘制三维相空间
figure
plot3(X, Y, Z, 'b.', 'MarkerSize', 5)
xlabel('x'); ylabel('y'); zlabel('z')
set(gca, 'YDir', 'reverse');
grid on

